package com.zlc.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

import android.view.View.OnClickListener;
import android.widget.Button;

public class TrendsProxyOnClickListener implements InvocationHandler {
	
	private OnClickListener o;
	
	public TrendsProxyOnClickListener(OnClickListener o) {
		super();
		this.o = o;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		Object result = null;
		
		System.out.println("begin");
		
		Button b = (Button) args[0];
		
		System.out.println(b.isSelected() + " selected");
		result = method.invoke(o, args);
		
		System.out.println("end");
		return result;
	}

}
